package com.test30_IO流;

import org.junit.Test;

import java.io.File;
import java.io.FileWriter;
import java.io.Writer;

/**
 * Writer，字符输出流
 */
public class Demo03_Writer {

    @Test
    public void test1() {
        File file = new File("F:" + File.separator + "muyan" + File.separator + "vip" + File.separator + "yootk.txt");
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        try (Writer out = new FileWriter(file)) {
            out.write("www.yootk.com\r\n");   // 输出信息
            out.append("edu.yootk.com\r\n");      // 追加输出信息
        } catch (Exception e) {
        }
    }
}
